package com.springboot.web.entity;

public enum Rating {
    G("G"),
    PG("PG"),
    PG_13("PG-13"),
    R("R"),
    NC_17("NC-17");

    private final String name;

    Rating(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    // 自定义方法：根据名称解析枚举
    public static Rating fromName(String name) {
        for (Rating rating : Rating.values()) {
            if (rating.name.equalsIgnoreCase(name)) {
                return rating;
            }
        }
        throw new IllegalArgumentException("No enum constant with name: " + name);
    }
}
